What is the function of the relative pronoun in the adjective clause?

We all enjoyed the play that you wrote.


A.
direct object

B.
subject

C.
object of a preposition

D.
possessive