You swap an AirPod with your friend and then use text-to-speech to communicate with them. The video shows someone using Google Translate, but any app could presumably be used just fine. And the results should be the same regardless.
This is a perfect way to communicate in class without getting notice or even cheat. For more information do check out here.