The ability of the immune system to eliminate and shape the immunogenicity of tumours defines the process of cancer immunoediting1. Immunotherapies such as those that target immune checkpoint molecules can be used to augment immune-mediated elimination of tumours and have resulted in durable responses in patients with cancer that did not respond to previous treatments. However, only a subset of patients benefit from immunotherapy and more knowledge about what is required for successful treatment is needed2–4. Although the role of tumour neoantigen-specific CD8+ T cells in tumour rejection is well established5–9, the roles of other subsets of T cells have received less attention. Here we show that spontaneous and immunotherapy-induced anti-tumour responses require the activity of both tumour-antigen-specific CD8+ and CD4+ T cells, even in tumours that do not express major histocompatibility complex (MHC) class II molecules. In addition, the expression of MHC class II-restricted antigens by tumour cells is required at the site of successful rejection, indicating that activation of CD4+ T cells must also occur in the tumour microenvironment. These findings suggest that MHC class II-restricted neoantigens have a key function in the anti-tumour response that is nonoverlapping with that of MHC class I-restricted neoantigens and therefore needs to be considered when identifying patients who will most benefit from immunotherapy.