Using the eyedropper tool you can determine that the RGB values of the grays in both square A and square B are 120-120-120.
By viewing patches of the squares without the surrounding context, you can remove the effect of the illusion. A piece of cardboard with two circles removed will work as a mask for a computer screen or for a printed piece of paper.
This is another way to isolate the patches from their surrounding context. Cut out each square along the edges. Remove them. Hold them side by side. Please note that some printers, especially laser printers, have “enhancement” processing that increases the contrast of edges. This can cause the printed squares to have slightly different values of gray.