# [Tex/LaTex] Why does \widehat behave differently if I insert \hspace{0pt}

accentsmath-mode

I am getting some inexplicable behaviour from \widehat:

\documentclass[12pt,a4paper]{article}
\usepackage{amsfonts}
\begin{document}
$\fbox{\widehat{\mathcal{C}}}, \fbox{\widehat{\hspace{0pt}\mathcal{C}}}, \fbox{\widehat{\mathcal{C}\hspace{0pt}}}, \fbox{\widehat{\hspace{0pt}\mathcal{C}\hspace{0pt}}}$
\end{document}

Notice that the hat is misaligned in the first instance, but correctly aligned in all the other instances. Why does \hspace{0pt} make such a difference?

Also, how can I replicate this effect for other alignment problems? At the moment I am having trouble with the bounding boxes for the script font I am using…