Least squares estimator for a class of subdiffusion processes