Ion-exchange equilibria involving complex formation in aqueous solution