According to Daniel Gillespie in A Quantum Mechanics Primer (1970),
" . . . any observable which in classical mechanics is some well behaved function of position and momentum, f(x,p), is represented in quantum mechanics by the operator f ( \hat{x} , \hat {p} ) . That is,
a = f (x,p) . . ...