Look again at this
            sentence:
            The man
            who lives next to me has a goat.
            In its own clause, who
            functions as the subject. who is the subject
            of the verb lives. For this reason, who
            is in the nominative case. But the relative pronoun
            does not always function as the subject. Consider the
            following sentence:
            He is the man whom
            you saw. 
            In this example, whom is not
            the subject in its own clause. you is the
            subject of the verb saw. whom is the
            direct object. For this reason, the objective case, whom,
            is used rather than the nominative case, who.
            So also in Greek, as a rule, the
            case of the relative pronoun is determined by its
            function in its own clause. Consider two of the
            examples we have already cited:
            Τιμόθεον,  
            ὅς ἐστίν μου τέκνον (1
            Co. 4:17)
            Timothy,
            who is my child
            The relative pronoun ὅς is
            nominative because it functions as the subject in its
            own clause. It is the subject of the verb  
            ἐστίν. The fact that it does not agree
            in case with its antecedent is inconsequential.
            
            
            ἐκλεκτῇ κυρίᾳ καὶ τοῖς τέκνοις αὐτῆς, οὓς 
            ἐγὼ ἀγαπῶ  (2 Jn. 1)
            to [the]
            elect lady and to the children of her, whom I love
            In this example, the relative pronoun
            οὕς is accusative because in its own clause it functions
            as the direct object of the verb ἀγαπῶ - I love whom.