Can't access blueprint character from c++

Hey guys,

I’m making a game where I need to spawn minions from a “MilitaryBase” and change the class of the minions spawned by clicking on the base.

Right now, I can spawn without any problem minions from my Blueprint “Minion_BP” that are based on “AMinion” class that I created in c++. But for some reason I cannot do the same with my “MyTank_BP” that is based on “AMyTank” class.

It it important to note that AMyTank inherits from AMinion.

Here is some code

MilitaryBase.h
#pragma once

#include "GameFramework/Actor.h"
#include "Building.h"
#include "Minion.h"
#include "MyTank.h"
#include "MilitaryBase.generated.h"

UCLASS()
class PROJETDEC_API AMilitaryBase : public ABuilding
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMilitaryBase();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;
	UFUNCTION(Category = Default)
		void OnClickAction(UPrimitiveComponent* TouchedComponent, FKey key);

	UPROPERTY(EditAnywhere)
		UShapeComponent* Root;

	UPROPERTY(EditAnywhere)
		UStaticMeshComponent* MyMesh;

	float currentTime=0.f;

	FVector startingLocation;

	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
		TSubclassOf<class AMyTank> spawningTank;

	FRotator startingRotation;

	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
		TSubclassOf<class AMinion> spawningMinion;

	void SpawnMinion();

	uint8 toSpawn = 0;
};

MilitaryBase.cpp

#include "ProjetDEC.h"
#include "MilitaryBase.h"

AMilitaryBase::AMilitaryBase()
{

	PrimaryActorTick.bCanEverTick = true;

	RootComponent = Root;

	MyMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MyMesh"));
	MyMesh->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepWorldTransform);

	MyMesh->OnClicked.AddDynamic(this, &AMilitaryBase::OnClickAction);
}

void AMilitaryBase::OnClickAction(UPrimitiveComponent* TouchedComponent, FKey key) {
	if (toSpawn == 0) {
		toSpawn = 1;
	} else {
		toSpawn = 0;
	}
}

// Called when the game starts or when spawned
void AMilitaryBase::BeginPlay()
{
	Super::BeginPlay();
}

// Called every frame
void AMilitaryBase::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

	currentTime += 1 * DeltaTime;

	if (currentTime >= 5) {	
		SpawnMinion();
		currentTime = 0.f;
	}

}

void AMilitaryBase::SpawnMinion() {
	startingLocation = GetActorLocation();

	if (teamA) {
		startingLocation.Y -= 300.f;
	}
	else {
		startingLocation.Y += 300.f;
	}
	//startingLocation.X = -1300.f;
	startingLocation.Z = 130.f;

	startingRotation.ZeroRotator;

	FActorSpawnParameters spawnParams;

	spawnParams.Owner = this;

	spawnParams.Instigator = Instigator;

	//if serveur spawn
	if (Role == ROLE_Authority) {
		if (spawningTank == nullptr) {
			GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("tank is null"));
		}
		AMinion* newMinion = nullptr;
		if (toSpawn == 0) {
			newMinion = GetWorld()->SpawnActor<AMinion>(spawningMinion, startingLocation, startingRotation, spawnParams);
		}
		else {
			newMinion = GetWorld()->SpawnActor<AMyTank>(spawningTank, startingLocation, startingRotation, spawnParams);
		}

		newMinion->SetTeam(teamA);
	}
}

Here is a picture so you can see that both my blueprints really inherits from my c++ classes

Thanks in advance for any help!

using BP classes in C++