The flipped classroom is a teaching tool where the students prepare in advance, typically by reading a text or watching a video. The in-class time is then spent in discussions. We have introduced the flipped classroom as part of two courses in the astrophysics masters. I will describe why we chose to introduce the flipped classroom, the changes that we made, how we chose to adapt the technique to make it work for physics teaching, and reflections on how well it has worked from the teachers' and students' viewpoints.