Add conversion operators to StateElement and derived