A class of polynomial planar vector fields with polynomial first integral