The easy way to tell which is technically correct is to substitute he and him for who and whom, then rearrange the word order to see which sounds right.
“Who were you speaking to?” becomes “You were speaking to he” — which is clearly incorrect.
Main IELTS Pages:
This website is to develop your IELTS skills with tips, model answers, lessons, free books, and more. Each section (Listening, Speaking, Writing, Reading) has a complete collection of lessons to help you improve your IELTS skills.
Subscribe for free IELTS lessons/Books/Tips/Sample Answers/Advice from our IELTS experts. We help millions of IELTS learners maximize their IELTS scores!