The Grammar Doctor

Q. Which is correct: Give the package to whoever answers the door or should it be, whomever answers the door?

A. It should be, "whoever answers the door."
One might be tempted to say "whomever" because it follows a preposition.
However the object of the preposition is not "whomever." It is the entire clause: whoever answers the door.
"Whoever" is the subject of the clause.