It's an instinct left over from when they are kittens. A kitten will nead it's mothers belly to produce milk. When they need something, as adults they are both scent marking it with the glans on their paws, making it there's, and getting ready to relax. They often do it around humans because like their mothers we feed them. So treat it as a sign of affectional cuboard love.
For the most part, cats extend their claws for several reasons, usually something involving hunting, self defense, climbing, traction on surfaces, and "kneading". It's thought that this might be a fluffing type of behavior, as humans like to fluff their pillows, a cat likes to fluff its bedding.
I have been told that when it was a kitten it was weened to early. My fiance finds it very annoying from our 10 years old cat who was found at a barn.