But what does this have to do with the English language?
Well, when we talk of situations which are not true (for example when we express a wish) we should use a verb in the subjunctive mood. In the sentence If I were an astronaut..., were is in the subjunctive mood because I am talking about a situation which is not real. Many people would have written If I was an astronaut..., where was is in the indicative mood.
Similarly, the song If I were a rich man from the movie Fiddler on the Roof correctly uses the subjunctive were because the character in the film is not rich; he is just singing about what he would do if indeed he were rich.
Likewise, were is correctly used in the following sentences:
- If I were you I would... (in reality I am not you)
- If you were the Prime Minister what would you do to tackle corruption? (in reality you are not the Prime Minister)
- I wish you were here.
It is for this reason that If God was a Banker, a novel written by Ravi Subramanian, should have used the subjunctive, were, in the title. The same holds true for the Ronan Keating song Carrickfergus, whose first line reads: I wish I was in Carrickfergus; were would have been more appropriate. Ditto for Enrique Iglesias' Wish I was your lover.
You can read more on this topic here and here.
The use of the indicative was is very common, nevertheless. A google search for "I wish I was" produced 350 million results whereas "I wish I were" gave 59.4 million.