Tests of lepton universality in B0→KS0ℓ+ℓ− and B+→K∗+ℓ+ℓ− decays where ℓ is either an electron or a muon are presented. The differential branching fractions of B0→KS0e+e− and B+→K∗+e+e− decays are measured in intervals of the dilepton invariant mass squared. The measurements are performed using proton-proton collision data recorded by the LHCb experiment, corresponding to an integrated luminosity of 9fb−1. The results are consistent with the Standard Model and previous tests of lepton universality in related decay modes. The first observation of B0→KS0e+e− and B+→K∗+e+e− decays is reported.