Ask is a transitive verb: it takes a Direct Object (DO), in its simplest form a noun phrase:
Anne asked me [DO a question].
If we want to represent Anne's exact words, we use the question she actually asked, followed by a question mark and enclosed in quotes, in that DO position:
Anne asked me "Who is your favorite actor?"
The quotes mark this as a distinct constituent.
But in indirect speech, when we want to convey the substance of her question, we use a kind of relative clause (a free or fused relative clause) which can act as a nominal phrase in the DO position. This kind of clause starts with an ordinary declarative clause ... replaces the term asked for with an interrogative/relative term ... and moves that term to the front of the clause:
your favorite actor was _______
your favorite actor was who
who your favorite actor was
Note that the same clause can represent my answer—a situation where it cannot represent a question:
I told her who my favorite actor was.
In fact this sort of clause can act like a nominal phrase in almost any context—for example, as the object of a preposition:
She was curious about who my favorite actor was.
It can act as the Subject of a sentence:
Who my favorite actor was was the subject of her inquiry.
And in this sentence, a copulation, free relative clauses act as both Subject and Predicate Complement:
Who my favorite actor was was what she wanted to know.