Yeah unfortunately most people are like that, they want your friendship only while it's useful to them. I've had many of those "friends" who were friends only while they needed it, but after that they disappear.
I hate that about people, specially because I tend to care a lot about others, so I get your struggle.