I think the function call should be BindAction. Anyways i do it this way.
In your Editor, Edit->Project Settings->Input
I would add an Action Input With Name Like “Fire” then the key for it say Left Mouse Button.
Then in the C++ SetupPlayerInputComponent() function i would add it this way
PlayerInputComponent->BindAction(“Fire”, IE_Pressed, this, &Foo::foo);