What is the function of the noun clause in this sentence?

The street musicians sang to whomever passed them.

subject

appositive
object of a preposition

direct object