  The first measurement of the inclusive cross section for top quark pairs
($\mathrm{t\bar{t}}$) produced in association with two additional charm jets is
presented. The analysis uses the dileptonic final states of $\mathrm{t\bar{t}}$
events produced in proton-proton collisions at a centre-of-mass energy of 13
TeV. The data correspond to an integrated luminosity of 41.5 fb$^{-1}$,
recorded by the CMS experiment at the LHC. A new charm jet identification
algorithm provides input to a neural network that is trained to distinguish
among $\mathrm{t\bar{t}}$ events with two additional charm
($\mathrm{t\bar{t}c\bar{c}}$), bottom ($\mathrm{t\bar{t}b\bar{b}}$), and
light-flavour or gluon ($\mathrm{t\bar{t}LL}$) jets. By means of a template
fitting procedure, the inclusive $\mathrm{t\bar{t}c\bar{c}}$,
$\mathrm{t\bar{t}b\bar{b}}$, and $\mathrm{t\bar{t}LL}$ cross sections are
simultaneously measured, together with their ratios to the inclusive
$\mathrm{t\bar{t}}$ + two jets cross section. This provides measurements of the
$\mathrm{t\bar{t}c\bar{c}}$ and $\mathrm{t\bar{t}b\bar{b}}$ cross sections of
8.0 $\pm$ 1.1 (stat) $\pm$ 1.3 (syst) pb and 4.09 $\pm$ 0.34 (stat) $\pm$ 0.55
(syst) pb, respectively, in the full phase space. The results are consistent
with expectations from the standard model.
