This is one of those tough grammar questions in writing that even I have a tough time remembering. When do I use who and when do I use whom? The following is an easy way to remember this distinction.
Use who when you could replace it with he or she.
Example 1: Who/whom is driving in the car? Answer: He/she is driving the car, so use who.
Example 2: John wished he knew who/whom left the money. Answer: He/she left the money, so again use who.
Use whom when you could replace it with him/her.
Example 1: To who/whom am I listening? Answer: I am listening to him/her, so whom is correct.
Example 2: Mary is the girl who/whom I am seeing. Answer: I am seeing her, so use whom.