I think I figured out how this can be expressed mathematically. The units can be thought as mathematical constants and physical quantities as numbers multiplied by that constants (units). So when we add two same quantities with same units we can add the numbers, for example:
$\rm 2\hspace{0.2cm} apples + 5\hspace{0.2cm} apples = 2\cdot a +5\cdot a = (2+5)\cdot a=7\cdot a = 7\hspace{0.2cm} apples $
But for different quantities we can't add the numbers:
$\rm 2\hspace{0.2cm} apples + 5\hspace{0.2cm} oranges = 2\cdot a +5\cdot o $
thereforeTherefore, we can't write :
$\rm 2\hspace{0.2cm} apples + 5\hspace{0.2cm} oranges = 7\hspace{0.2cm} apples + oranges$
However we can multiply (and divide) them, multiplying the numbers and the units:
$\rm 2\hspace{0.2cm} apples \cdot 5\hspace{0.2cm} oranges = (2\cdot a) \cdot (5\cdot o) = (2\ \cdot 5) \cdot (a\cdot o) =10 \cdot (a\cdot o)=10\hspace{0.2cm} apples \cdot oranges$
This seems to work.