Ab initio study of the molecules BC and B2C