Combining the three classes, there are 17 + 14 + 15 = <<17+14+15=46>>46 male students.
Similarly, there are 13 + 18 + 17 = <<13+18+17=48>>48 female students.
Thus, there are 48-46 = <<48-46=2>>2 students who cannot partner with a student of the opposite gender.
#### 2