  The production cross section of a top quark pair in association with a photon
is measured in proton-proton collisions in the decay channel with two
oppositely charged leptons (e$^\pm\mu^\mp$, e$^+$e$^-$, or $\mu^+\mu^-$). The
measurement is performed using 138 fb$^{-1}$ of proton-proton collision data
recorded by the CMS experiment at $\sqrt{s} =$ 13 TeV during the 2016-2018
data-taking period of the CERN LHC. A fiducial phase space is defined such that
photons radiated by initial-state particles, top quarks, or any of their decay
products are included. An inclusive cross section of 175.2 $\pm$ 2.5 (stat)
$\pm$ 6.3 (syst) fb is measured in a signal region with at least one jet coming
from the hadronization of a bottom quark and exactly one photon with transverse
momentum above 20 GeV. Differential cross sections are measured as functions of
several kinematic observables of the photon, leptons, and jets, and compared to
standard model predictions. The measurements are also interpreted in the
standard model effective field theory framework, and limits are found on the
relevant Wilson coefficients from these results alone and in combination with a
previous CMS measurement of the $\mathrm{t\bar{t}}\gamma$ production process
using the lepton+jets final state.
