How to become a good friend
1) Give advice, add perspective.
Don't judge your friend, but do advise to stay out of situations where they may harm themselves or others.
2) Give your friend space
Understand if he/she wants to be alone or hang out with other people. Allow it to happen. There's no need to become needy.
3) Listen to them.
You don't have to agree with them - just listen to what they have to say. Make sure when they are talking, you are not speaking a word before they stop.
4) Don't be selfish.
Grabbing and stealing are big NOs in the rules of friendship. The friend will soon get tired of this and eventually more towards more selfless people who are willing to give what they get.
5) Learn to share
As before, if you have a selfless friend, they will expect something back, even if they don't make it obvious. This does not necessarily mean giving them large expensive presents. This can just mean being there for them when they need you.
6) Live by the golden rule.
Always treat a friend as you would want to be treated. If you don't there will be impact. Don't do or say anything to them that you wouldn't want done to you. Be there for them through thick and thin as long as they are a TRUE friend to you. Also learn to forgive, and apologize.