Then make an effort to keep in contact. The thing is, as with any friendships, if they're made because you met in this same place (school, university, work, etc.) and that's the main/only place you socialise with them, they're likely to be friendships of convenience. If you want to retain them, then you have to make an effort to see them outside of the usual place and communicate with them often (this'll depend on your friendship, not everyone needs to talk daily/weekly to retain friends).
I've not kept any friends from university, but I still have a few from school.