BindAction and EnableInput not working for an Actor

I’m using EnableInput whenever the beginoverlap event is called and the OtherActor is my character but it doesn’t work. I googled around and couldn’t find any answers that worked for me is there something I’m missing?
Using when I use the Fire Event in blueprints it works even without enabling input.

Setup in the Header file:

void FireHandler();
UInputComponent* InputComp;

Inside the constructor:

InputComp = CreateDefaultSubobject<UInputComponent>(TEXT("InputComp"));
InputComp->bBlockInput = bBlockInput;


InputComp->BindAction("Fire", IE_Pressed, this, &AMasterWeapon::FireHandler);


ACharacter* MyChar = Cast<ACharacter>(OtherActor);
if (MyChar != nullptr) {
	UE_LOG(LogTemp, Warning, TEXT("In"));


UE_LOG(LogTemp, Warning, TEXT("Fire"));

Managed to fix it. Seems like every actor has a variable called InputComponent by default and by using

InputComponent = InputComp;

In BeginPlay my problem was solved.