I did that but I didn’t use the class directly, but UClass
static ConstructorHelpers::FObjectFinder<UClass> PlayerPawnBPClass(TEXT("Class'("/Game/Character/BP_HeroAC.BP_HeroAC'"));
if (PlayerPawnBPClass.Object != NULL)
DefaultPawnClass = PlayerPawnBPClass.Object;
After you can cast it to you class type.
D.