I had to put #include "Components/StaticMeshComponent.h"
in MyPawn.cpp. I think the problem is because with out the include StaticMeshComponent is treated as an incomplete type and it doesn’t know how to implicitly cast it.
If anyone knows better I’d be interested to hear. I’m only guessing from a quick google and some testing in visual studio.
Edit: Clarity.