This paper studies the relation between teaching quality and research productivity using a detailed database for students in higher education. In order to measure teaching quality, we employ a version of the value-added methodology which uses future performance of students to make inferences about the current teaching quality of their professors. We report a mild but positive and significant relation between publications on top journals and teaching quality. To all practical effects, this finding does not seem to be contaminated by the potential negotiating power of professors with high levels of top publications strategically choosing the best-performing groups. Additionally, we report evidence that the random assignment of students into class groups is reasonably satisfied. Finally, we argue that teaching effectiveness measures based on anonymous student evaluations are suspicious and debatable.