This question is from a collection of past master's exams.
Let $G$ be a group with a subgroup as described in the title. I'd like to show that this subgroup, say $H$, is in the center of $G$. My intuition is to choose some element $x \in H$ (and thus in every nontrivial subgroup $K$ of $G$) and then apply the counting formula; i.e. the order of $G$ is the product of the order of the centralizer of $x$ with that of its conjugacy class. I feel like this, together with the class equation, should tell me everything I need to know. It's been awhile since I've done a problem like this, so any help would be appreciated.