Exact solution of a generalized version of the Black-Scholes equation