Cannot store child class in base class variable (written in C++) in Blueprints

I have two classes in C++:

Class A derives from UActorComponent and is supposed to be a Base Class

Class B derives from A

In Blueprints, I want to store an Object of class B in a variable of class A. This isn’t possible (“B Object Reference is not compatible with A Object reference”)
However, I don’t have any issues storing an Object of Class B in a variable of class UActorComponent.

How can I tell class B, that A is its base class?

Edit: Here are the classes:

Class A

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "ClassA.generated.h"

UCLASS( ClassGroup=(MyClass), meta=(BlueprintSpawnableComponent) )
class GAME_API UClassA : public UActorComponent
{
	GENERATED_BODY()  
public:	
	// Sets default values for this component's properties
	UClassA();
	UFUNCTION()
		virtual void myfunction();   
protected:
	// Called when the game starts
	virtual void BeginPlay() override;
	UFUNCTION(Server, Reliable, WithValidation)
		virtual void Server_Function();
	UPROPERTY()
		bool bVar = false;    
public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};

Class B

#include "CoreMinimal.h"
#include "ClassA.h"
#include "ClassB.generated.h"

UCLASS(ClassGroup = (MyClass), meta = (BlueprintSpawnableComponent))
class GAME_API UClassB : public UClassA
{
	GENERATED_BODY()
public:
	virtual void myfunction() override;	
};

Can we see the declaration for both the classes and the member variables in question

I added the code

The issue fixed itself after a few compiles.
This question can be closed

Hi @bldy_ch, you are sure you made no code changes between those compiles? Other peeps who find this post may not have such luck.

As of 4.20, there is an issue parsing tokens when a default subject has a space in the FName provided for instantiation. Even if you deleted intermediates, it would be helpful to others to have a resolution.

Godspeed developer.

I made one, but it was very specific to my project. I decided to reprogram everything in C++ and for some reason the old blueprint class with the same name was not deleted properly. It wasn’t visible in my editor anymore but I could still select it as a variable type. I noticed it when i tried to call myfunction() on it but couldn’t.