Match two distinct values from a single column in a joined table
Select c.class_id, c.class_name
  From class c, class_schedule cs
  Where c.class_id = cs.class_id
    And cs.student_id in (
          select student_id from student
            where student_name in ('studentA','studentB'))
  Group by c.class_id, c.class_name
  Having count(*) = 2

Check it out: DB Fiddle