The dean congratulated us freshmen. Who is used as the subject of a verb. Whom , used traditionally as the object of a verb, is used consistently today only after a preposition. John, who has a Ph.D., is very smart. Carlos is the poet to whom I was referring.
Most sentences consist of a subject, a verb, and an object.
The subject tells who or what the sentence is about. The verb tells what the action is. The object answers what. The boy ate the cookies. A pronoun changes form depending upon its place in the sentence.