Scene component in scene component works if its added to parent actor in c++ but not if added in BP

I’m adding scene components in other scene components in the OnComponentCreated() function like this:
(you can do this code the constructor instead if you want, same result)

void UNiceComponent::OnComponentCreated()
		Mesh = NewObject<UStaticMeshComponent>(this, "MyMesh");

This works for the most part but there is one big thing that doesn’t work.
If you add this component to an actor in BP and then create an actor based of that class (so it derives from the first class) it will instantly give a “Template mismatch” error in the log. This error also hinders the game from being built.

The wierd thing about this is if you add the component to the parent actor in c++ it works perfectly fine, you can create child actors from this class in BP without the error. And it works to build.

UNiceComponent* MyNiceComponent;