It's a son of my friend which is twenty years old.
In this sentence, which refers to which one, my friend or son? Is there any usual rule here?
On the other hand, how can I do if I want to use which to refer to the other one?
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
While on the face of it your friend is the one who is twenty years old, the sentence can be understood the other way. Context would be important. If a heavy banging on the door is heard and somebody asks "Who is that?" then your sentence would not be understood to mean your 20yo friend's toddler son.
If clarity is needed without context I would suggest "It's the son of my twenty year old friend", or "It's the twenty year old son of my friend."
'It's' is inappropriate; you should use 'He's'. Similarly, 'which' is inappropriate; you should use 'who'. Thus
'[He's] a son of my friend [who] is twenty years old.'
The relative pronoun 'who' refers to 'my friend'.
Modifiers are deemed to modify nouns closest to them. If you want to modify 'son', you can say
'He, who is twenty years old, is a son of my friend.'