How Does BP Actor Handle InputAction With No Input Component?

I am trying to handle an input action in a C++ class that is a UActorComponent. I thought doing:

AActor* rootComponent = GetOwner();

auto inputComponent = rootComponent ->InputComponent;

would give me an input component, but it does not, inputComponent is NULL.

I noticed that my actor (which is a BP class) for my UActorComponent can add a InputAction node to handle an input action. How does the BP actor class do this without an input component? Note I didn’t write the BP actor class so there may have been something they had to set for it to work properly. Basically what I am asking is how could I do the same in my C++ class?