Even when teacher and student are of legal age, I think it matters. That's an abuse of the teacher-student relationship and it's one of those situations where, even if the students are past childhood or adolescence, the teacher stilll has an unfair advantage and more significant leverage, particularly if the student is receiving grades from that teacher. Teachers of all ages need to go have sex with other populations than students.