C++ Project refuses to compile when I put an UPROPERTY on a UserWidget instance

I have this variable

	TSubclassOf<UUserWidget> WidgetTemplate;

This is the error that I get when trying to compile my project

error LNK2019: unresolved external symbol "__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UUserWidget_NoRegister(void)" (__imp_?Z_Construct_UClass_UUserWidget_NoRegister@@YAPEAVUClass@@XZ) referenced in function "class UClass * __cdecl Z_Construct_UClass_AProjectEgeriaCharacter(void)" (?Z_Construct_UClass_AProjectEgeriaCharacter@@YAPEAVUClass@@XZ)

The project does compile when I remove the UPROPERTY. Including UserWidget does not help the situation. Am I doing something wrong?

As far as I can tell the only thing missing would be “class”.

Try this:

TSubclassOf<class UUserWidget> WidgetTemplate;