You are right when you say that what we recognize as different species usually do not cross breed in nature (you are also right when you say that closely related species may sometimes,especially when humans help them, produce viable hybrids that are sterile). However it may happen that closely related species sometimes produce viable and fertile hybrids in nature...
Humans like to do categories and would like that everything easily and perfectly fit in these categories... Nature is often less strict. I think that nature likes the category "species" quite well. Species seem to really mean something biologically. However, it is not the case for most of the other taxonomic categories (familly, genus, sub-species...) humans created. What we call sub-species is often either a new discovered species without a formal latin name or group of individuals, within a species, sharing some morphological caracteristics.
Never believe what a teacher tells you