Former student freed as part of rare prisoner swap that Beijing said showed it would ‘never abandon compatriots’