A friend of mine attributes his new job to prayer. I think, given his qualifications and circumstances, he would have gotten the job anyway. Is it right to consider as an answer to prayer something which would have happened anyway?
Your question overlooks the possibility that your friend's prayer may well have been a factor in God granting him the qualifications and circumstances required for the job in the first place.
In his book Miracles, C. S. Lewis noted that the question of prayer and what "would have happened anyway" is like asking whether or not in Hamlet Ophelia (who falls into a river and drowns) dies because the branch upon which she climbs breaks or because Shakespeare wanted her to die. The answer, says Lewis, is both. He writes:
Every event in the play happens as a result of other events in the play, but also every event happens because the poet wants it to happen. All events in the play are Shakespearian events; similarly all events in the real world are providential events. All events in the play, however, come about (or ought to come about) by the dramatic logic of events. Similarly all events in the real world (except miracles) come about by natural causes. 'Providence' and Natural causation are not alternatives; both determine every event because both are one.
What "would have happened anyway" isn't something we can know, because what actually happened is influenced by our prayers (or our failure to pray). Even though the thing we're praying for presently has, in a sense, already been decided by the events which preceded it (excluding miracles) and these events (ultimately) by divine providence from all eternity, this doesn't make our petitions to no effect.
One of the things God took into account in deciding how things would come out was our prayers here and now. In this way our prayers can be, under God, real causes of events set in motion before the foundation of the world.
Because we're in time and God isn't, we have trouble seeing how this can be. While we must talk as if God exists on the same timeline as we do (even if we imagine that his presence on it stretches infinitely back and infinitely forward), this isn't really the case because he is outside time altogether.
This means the events which happened yesterday and which went into our present state of affairs are as present to God as the prayers we utter today. Confusing? Yes, but that doesn't mean such an explanation is illogical. Because of our limited (and fallen) reason, there's much we can comprehend only partially--or not at all. Time is one of those things. But don't worry: We'll all understand this perfectly in, say, 90 years.