Add custom Blueprint component via C++

Hi, I want to add a custom Blueprint component on multiple Actors in the scene.

I can use green button Add Component, but I have hundreds of objects.
If I select multiple Actors, green button disappears.
If I add it via Blueprints, it will work, but the component will live only until editor is restarted. After re-launch, these components will be gone - they are inherited from this custom class, but not instanced - see two pictures.


I decided to do c++ scrip to auto attach my custom Blueprint Component, but I fail. Note that this is editor - I want to automate things.

C++

UActorComponent* UMapConstructionHelper::AddClassOnSelectedActor(AActor* aActor, const UClass* addThisClass)
{
	FTransform trans = aActor->GetTransform();
	UActorComponent* Component = aActor->AddComponent("Some Class", true, trans, addThisClass);
	return Component;

Header file:

	UFUNCTION(BlueprintCallable, Category = "ConstructionHelper")
		 static UActorComponent* AddClassOnSelectedActor(AActor* aActor, const UClass* classToAdd);

image_2022-03-25_120103

Codes runs trough, but the blueprint class is not added.

Thank you.

Update:
I managed to add my custom blueprint component via code, but the issue is exactly the same as if I use Blueprint constructor script to add it. It becomes Inherited, so it disappears on restart and is not editable by hand.
Code line for that was:

	aActor->AddComponentByClass(addThisClass, false, RootComponent->GetComponentTransform(), false);