So it has to do with how the tuning works. Technically speaking, every key should use a different tuning temperament to sound the best. Temperament refers to the intervals between the notes. If you tuned all the intervals in an octave perfectly, the octave notes would be out of tune with each other. So we use the equal temperament (at least on pianos), which stretches the intervals a little, meaning that the tuning isn't quite perfect, but the octaves are.
So, if you were playing in a key with C flat and the tuning was correct, it would be a slightly different pitch than that of a B in its own key tuned correctly.