Using a function in different class

I’m trying to call a function that was defined inside of the implementation file of an actor component (QuestComponent.cpp) inside of the implementation file of a different actor component (Interact.cpp).

When the player presses ‘f,’ Interact searches for an actor, checks if that actor has one of the three interact-able components (QuestComponent, ShopComponent, or AmbienceComponent), then executes the corresponding function. Each of the three components’ functions that need to execute inside of Interact.cpp are defined in their own implementation files.

I have all of this working except when I tried to use the corresponding functions, I was met with a C3861 compiler error. I’ve been told that this was because I cannot use a different class’s method and that I need to use casting to resolve it.

I’ve spent a lot of time learning regular C++ casting but could not fight any suitable tutorials or explanations for Unreal Engine 4 casting. The only ones I find are inside of walkthroughs for entire games so they don’t explain how to use it for any other purpose. Unreal’s documentation of Cast is very confusing and I can’t understand what I need to do.

Can anyone help me figure this out?

Thanks in advance!

A bit of code or more information would be helpful.
In your other question you wrote you want to cast to the actor component, but why? You would want to cast your raycasted actor, because it would contain a variable / pointer to your actor component that’s already the right type:

UMyInteractionActorComponent* InteractionComponent;

Then you can just call YourRaycastedActor->InteractionComponent->InteractionFunction();