Four ideas how to test the amount of light coming from each square
(1) Try putting the image in Photoshop
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.
(2) Cut out a cardboard mask
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.
(3) Print the image and cut out the squares
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.
You have to be careful if you reimage the squares, because their new context might bias your perception again. Moving them around in reality helps.
(4) Get a photometer