Friendship between two people can come in many different forms. In a companionship you could just be acquaintances, where at one time or another someone might have done something for you that might have changed your life for the better. To this individual you feel as if you owe them a favor in return. For this reason you would always help them in their time of need.
In the movie Tombstone, Wyatt Earp was the only amigo that Doc Holiday ever had. So no matter when Wyatt was in trouble Doc was always there for him. For example the time all of Wyatts' brothers were murdered and Wyatt took revenge on the people who did it. So, even though on his death bed, Doc Holiday, got up and went with Wyatt to help him slay them. This is one way that a friendship can form between two people.
A further example of the friendship between Wyatt and Holiday was when the Dalton gang had come into town with their guns and went into the O.K. Corral. They were going to get Wyatt for killing one for their brothers. Doc knew that Wyatt might of been killed if he went there on his own. So again, even though not in the best of health, Doc went to help Wyatt out.
Another type of friendship is the one that came between John Oakhurst and young Tom Simson in the story of The Outcast of Poker Flat. In this camaraderie the two men were in a poker game and young Simson lost all of his money to Oakhurst. After the game Oakhurst pulled him aside and gave him his money back and a little lecture on not to gamble any more. By this he made a slave (friend) for life. A few months later when Oakhurst became exiled out of town and Tom happened to blunder upon him. He gave him some of the food he had to survive.
As you can see there are many different shapes and forms that friendships can come in but in all they are similar. From the loyalty of just being a friend to just owing someone something for helping you....