  Context: Cepheids are excellent tracers of young stellar populations. They
play a crucial role in astrophysics as standard candles. The chemistry of
classical Cepheids in the Milky Way is now quite well-known. Despite a much
larger sample, the chemical composition of Magellanic Cepheids has been only
scarcely investigated. Aims: For the first time, we study the chemical
composition of several Cepheids located in the same populous cluster: NGC 1866,
in the Large Magellanic Cloud (LMC). To also investigate the chemical
composition of Cepheids at lower metallicity, four targets are located in the
Small Magellanic Cloud (SMC). Our sample allows us to increase the number of
Cepheids with known metallicities in the LMC/SMC by 20%/25% and the number of
Cepheids with detailed chemical composition in the LMC/SMC by 46%/50%. Methods:
We use canonical spectroscopic analysis to determine the chemical composition
of Cepheids and provide abundances for a good number of $\alpha$, iron-peak and
neutron-capture elements. Results: We find that six Cepheids in the LMC cluster
NGC 1866 have a very homogeneous chemical composition, also consistent with red
giant branch (RGB) stars in the cluster. Period--age relations that include no
or average rotation indicate that all the Cepheids in NGC 1866 have a similar
age and therefore belong to the same stellar population. Our results are in
good agreement with theoretical models accounting for luminosity and radial
velocity variations. Using distances based on period-luminosity relations in
the near- or mid-infrared, we investigate for the first time the metallicity
distribution of the young population in the SMC in the depth direction.
Preliminary results show no metallicity gradient along the SMC main body, but
our sample is small and does not contain Cepheids in the inner few degrees of
the SMC.
