'To wish' is to want something that is unlikely to happen. We use 'I wish' to talk about:
1. something we wish were different about our present situation: 'I wish' + (past tense sentence):
- I wish I had a boyfriend. (= 'have' becomes 'had' in past tense)
2. a wish or regret about the past. The form is 'I wish' + (past perfect sentence):
- I wish I had finished my homework. (= 'finish' becomes 'had finished' in past perfect)
'If only' means the same thing as 'I wish' but is stronger. We use 'if only' to talk about:
1. A strong wish that things could be different. The form is: 'If only' + (past tense sentence)
- If only I could speak English! (= 'can' becomes 'could' in past tense)
2. A strong wish or a regret about the past. The form is: 'If only' + (past perfect sentence).
- If only I had brought my wallet! (= 'bring' becomes 'had brought' in past perfect)