What that teacher did to the student was just the worst! He wanted to help him by drawing attention from the entire class to the fact he has no friends. That's just humiliating, especially to an introvert like that guy most likely is. The students were clearly mocking him with sarcastic comments, the student himself was visibly shaken and yet the teacher kept patting himself on the back for how he "solved the problem."
That guy is truly unfitting for being a teacher.