Does anyone know of a nice simple example of a space $X$ with an odd-dimensional integral cohomology class $a\in H^{2k+1}(X;\mathbb{Z})$ whose square is nonzero?


I once thought that the one-dimensional generator $a\in H^1(K;\mathbb{Z})\cong\mathbb{Z}$ in the cohomology of the Klein bottle had $a^2\in H^2(K;\mathbb{Z})\cong\mathbb{Z}/2$ nonzero, but it appears this is not the case. 



Wanted: Odd-dimensional integral cohomology class whose square is nonzero
As Ralph is being modest, I have decided to make his comment into a CW answer.


Recall that the short exact coefficient sequence $0\to \mathbb{Z}\to \mathbb{Z}\to \mathbb{Z}/2\to 0$ leads to a long exact sequence
$$
\cdots \to H^\ast(X;\mathbb{Z})\to H^\ast(X;\mathbb{Z})\stackrel{\rho}{\to} H^\ast(X;\mathbb{Z}/2)\stackrel{\beta}{\to} H^{\ast+1}(X;\mathbb{Z})\to\cdots $$
for any space $X$, where $\rho$ denotes reduction mod 2 and $\beta$ is the Bockstein homomorphism. Recall also that $\rho$ is a ring homomorphism, and that $\rho\circ\beta = Sq^1$, the first [Steenrod square](http://en.wikipedia.org/wiki/Steenrod_algebra). 


Let $X=\mathbb{R}P^\infty\times\mathbb{R}P^\infty$, and let $x,y\in H^1(X;\mathbb{Z}/2)$ denote the generators over each axis. Note that $c=\beta(xy) \in H^3(X;\mathbb{Z})$ is nonzero, since $$\rho(c) = Sq^1(xy) = Sq^1(x)y + x Sq^1(y) = x^2y + xy^2 \neq 0.$$ 


Similarly $c^2 \in H^6(X;\mathbb{Z})$ is nonzero, since we have
$$ \rho(c^2) = \rho(c)^2 = (x^2y+xy^2)^2 = x^4y^2 + x^2 y^4 \neq 0.
$$


As Will Sawin noted in his comment, we can get a finite-dimensional example by taking $Y=X^{(6)}$, the $6$-skeleton of $X$ (this is the smallest possible dimension, by Tom Goodwillie's comment). We could also take $Y=\mathbb{R}P^4\times\mathbb{R}P^4$ (but $ \mathbb{R}P^3\times\mathbb{R}P^3$ won't work, since its six-dimensional cohomology is torsion-free).


