A person might pray for his freind before praying for himself for one of tow reasons:
a.) Because his freind's problem genuinely bothers him more than his own problem. Or, b/) Because he wants the reward of being answered first (see Rashi to 20:1).
Generally, with acts of kindness, the result for the recipient is more important than the donor's motive. So even if a person prays for another because he wants the reward (of being answered first) he will still be rewarded, for after all he performed an act of kindness in praying for another.
Nevertheless, it goes without saying that the first approach above - the person with pure motives - is vastly superior.
(Based on Sichas Shabbos Parshas Vayeira 5743)