Use `const middle_query_t *` everywhere in the output classes.