I try to convert the following sentence to a wh-question replacing both direct and indirect object with wh-pronoun.
Tom gave him a book.
1) What did Tom give him?
The direct object is replaced with "what" and this sentence seems fine.
2) Who(m) did Tom give a book?
The indirect object is replaced with "who(m)" and somebody claims this sentence is not correct.
If they are right, please let me know the reason.