With the raster calculatorRaster Calculator under QGIS > Raster menu QGIS > Raster menu
:
(current@1 = 0 AND 2050@1 = 0) * 0 +
(current@1 = 1 AND 2050@1 = 1) * 1 +
(current@1 = 2 AND 2050@1 = 2) * 2 +
(current@1 = 3 AND 2050@1 = 3) * 3
To take into account gain (here value 4) and loss (here value -1) :
((2050@1 - current@1) = 0) * current@1 +
((2050@1 - current@1) > 0) * 4 +
((2050@1 - current@1) < 0) * -1