A person might pray for his friend before praying for himself for one of two reasons:
a) because his friend's problem genuinely bothers him more than his own problems; or
b) because he wants the reward of being answered first. [see Rashi Vayeira 21: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, Lubavitcher Rebbe