South Africa beat Australia by 6 wickets to win triangular series