As hard water flows through the Ca++ are exchanged for Na+ so that the calcium ions are sticked to the clay  and sodium ions come out into the water and in this way the water is softened  because the calcium is no longer there. 