Your sentence is correct. The understanding your classmates have about "had" is incorrect.
"Had" is past perfect. That means it's an event that was true, but is not currently true. Let's ignore the indirect speech for a moment, and convert the sentence to direct speech; that is, the command form.
Raise your hand if you have a question.
Compare this to:
Raise your hand if you had a question.
In this second sentence, the teacher is saying that if you had a question, but don't have a question now, you should raise your hand. This meaning is nonsense, and clearly not intended. The teacher says "have a question" because she wants you to raise your hand in order to ask the question that you still have.
Converting it into indirect speech, you must keep the same tense as the statement made in direct speech. Thus, "have" is correct.