It's usually that you develop feelings for them, not that you only befriended them in hopes of dating them.
I don't recall saying such a distinction mattered (although the latter is a truly retarded reason for being someone's friend). If you develop feelings for them and they're not returned, fine, take a step back to heal if you have to. But don't just flat out stop being their friend forever. The feelings of the other person
do matter (surprising, right?) even if they only go so far as friendship. Learn to let [dukar] go, Jesus.
Then you will either be well rewarded or have a right to be upset.
And whatever you do don't be upset at them. It's not their fault they're not attracted to you.