“What a hopeless fellow you are!” said the teacher to the student.

“What a hopeless fellow you are!” said the teacher to the student.

Explanation

The teacher told the student that he was a very hopeless fellow.

In indirect speech, "you are" changes to "he was" when referring to the student.

The sentence structure also changes to a statement with "that" for reported speech.