Invariance property of MLE: if $\hat{\theta}$ is the MLE of $\theta$, then for any function $f(\theta)$, the MLE of $f(\theta)$ is $f(\hat{\theta})$.
Also, $f$ must be a one-to-one function.
The book says, "For example, to estimate ${\theta}^2$, the square of a normal mean, the mapping is not one-to-one." So, we can't use invariance property.
But then, it proves the property and says, "we now see that MLE of $\theta^2$, the square of a normal mean is $\bar{x}^2$".
This seems self-contradicting, we are squaring $\bar{x}$, but square of anything is not one-to-one, what am I reading wrong here? Thanks!
source: Casella & Berger "Statistical Inference"