How do I link an actor with C++ code?

I have some code that I would like to use for a certain character. It simply makes the character move forward when I press “V” on my keyboard. It doesn’t seem to work, although the code compiles. How do I link the actor in the game with my C++ code?