Teachers can be incredibly important, even pivotal, in their students' lives.
You can be friends with teachers long after the teacher/student relationship ends. I am friends with two of my most important teachers from childhood/adolescence, one a man and the other a woman. I am 53. There was a hiatus between when the teacher/student relationship ended and when the friendship began but now they are some of the most crucial people in my life, and I in theirs, especially for the man who is lonely.
I am also friends now with the leader on my tough group, and our age difference of 9 years which was big when I was a teen has almost evaporated now that we are both adults and not he an adult and I a teen. With him, too, there was a long hiatus between when the tough group ended and when several decades later we connected on Facebook and started visiting each other (we live on different continents now).
When I visit my hometown, I always make a point of visiting these three people, the former teachers and the former youth group leader.
So it is entirely possible as long as you allow a passage of time after your student/teacher relationship comes to a closure.