【UE4 Reflection】Why const member in parent UClass would be private for child UClass ?

I have two uclasses and an compiler error here:

UCLASS(BlueprintType, Blueprintable)
class UCardCostFuncHolder : public UObject
{
	GENERATED_BODY()

	UCardCostFuncHolder() : CardCostDetails(FCardCost()){};
	
	UCardCostFuncHolder(const FObjectInitializer& ObjectInitializer) : CardCostDetails(FCardCost()){};
	
	UCardCostFuncHolder(const FCardCost& CardCost) : CardCostDetails(CardCost){};

public:

	const FCardCost CardCostDetails;
};
UCLASS(BlueprintType)
class UTest_CardCost : public UCardCostFuncHolder
{
	GENERATED_BODY()
};

And now visual studio give me an ERROR:

CardCostLibrary.h(11): error C2248: “UCardCostFuncHolder::UCardCostFuncHolder”: cannot access private member (declared in class “UCardCostFuncHolder”)

And when I check the code at that line, it’s just thie GENERATED_BODY() macro in class UTest_CardCost.

I think this error is related to unreal engine reflection system, and I want to know the solution about this error.

And it looks like the problem is caused by the inline expression on the constructor. Even if I remove the const keyword, this error still exists.

I just tried to modify the constructor several times, and I think this problem is just I don’t know how to do constructor for uobject. Now I will learn about that.

Base class constructor(s) should be public(at least protected) to be visible by child classes.

You are a lifesaver ! I’m so stupid ! I forget the scope specifer !

For dear friends visit this page, the Best Way to initialize an object in C++ in UE4 is:

Use Factory Function.

Forget about the raw C++ constructor. Use custom in class static factory function to initialize your object.