‘Who’ (/huː/) is an English pronoun used in either of the following instances:
1. used in questions to ask about the name, identity or function of one or more people
e.g. Who is that woman?
2. used to show which person or people you are referring to
e.g. The couple who visited yesterday did not eat our food.
3. used to give more information about somebody
e.g. That same woman, who stopped by yesterday, is calling again.
In English language, ‘Whom’ (/huːm/) is used instead of ‘who’ as the object of a verb or preposition.
e.g. The same woman, whom he gave roses, has asked him not to talk to her again.
When to use ‘who’ or ‘whom’
Generally speaking, “whom” is disappearing from spoken English. It is widely considered old-fashioned. Though it still appears in formal writing, there is hardly any case where “whom” is used that it is the only good fit.
Check this sentence: I have a few friends with whom I like hanging out.
This sentence can easily still go this way:
“I have a few friends who I like hanging out with.”
A good reason not to use “whom” here is that “whom” is formal but “hang out with” is informal and the contrast is uncomfortable. If you want to raise the level of formality a notch I’d just say:
“I have a few friends who I like being with.”
Either of the sentences sounds fine.
“Whom” is almost becoming archaic English. The kind you only find in legal texts and philosophy textbooks.
“To whom I gave the present” sounds distinctly archaic.
“Whom I gave the present to”, whilst grammatically correct, sounds weird.
Only “Who I gave the present to” sounds vaguely like English.