To put it nicely, friends are there to help each other, but to put it bluntly, friends are just people who make use of each other. Of course not everyone is like that, but I think it is quite often the case that friends disappear when either you are in trouble and friends drift away slowly(because they have too much problems to cope with even on their own that they don't have much energy left to help you), or vice versa (when your friend is in trouble and you drift away slowly). Its not always intentional, but it happens without us realizing it sometimes.
In the other cases of 'friends', they aren't true friends, they are just people who stick together because they want someone to have lunch with, someone to go to the shops with, someone to go clubbing with. In other words, some friends are people who make use of each other for company. When I was in school, there was a group of friends that I had that were like that. I didn't feel we were true friends, but rather, I felt we sticked together because we needed each other. I didn't want to be seen sitting in lectures or the canteen alone, neither did they, so we sticked together and became 'friends'.