Generalized sixth-order gravity and inflation