The grammatical name for "whose cake is the best" is a subordinate interrogative clause.
To understand the function of this clause, it is important to break down the sentence.
The main clause in this sentence is "whose cake is the best." Within this main clause, "whose cake" is the subject, "is" is the main verb, and "the best" is the complement of the verb.
The entire subordinate clause "whose cake is the best" functions as the direct object of the main verb. It provides additional information about the cake and answers the question of whose cake is being referred to.
So, in summary, "whose cake is the best" is a subordinate interrogative clause that functions as the direct object in the sentence.