Programatically enrol user?

We are doing some programming. In CoursePress 1.x I could do this to enroll a user with ID 15 into course 167.

$studentObject = new Student(15);
$studentObject -> enroll_in_course(167);

Now with CoursePress 2 I get Fatal error: Class 'Student' not found. Can you tell me how to enroll a user into a course with CP 2 via code?