Infrared photometry of Cepheids in the LMC clusters NGC 1866 and NGC 2031