Optical anomalous Hall effect enhanced by flat bands in ferromagnetic van der Waals semimetal