Get the post children count of a post

class MyClass {

    ...

    function post_count_filter($where) {
        global $wpdb;
        str_replace("WHERE", "WHERE ".$wpdb->posts.".post_parent = ".$this->count_parent." AND", $where);
        return $where;
    }

    function count_children($post_id) {
        $this->count_parent = $post_id;
        add_filter('query', ( &$this, 'post_count_filter') );
        $stats = wp_count_posts('myposttype');
        remove_filter('query', ( &$this, 'post_count_filter') );
        unset($this->count_parent);
        return array_sum( (array)$stats );
    }

    // example of use
    function xyz() {
        global $post;
        ...
        $child_count = $this->count_children($post->ID);
        ...
    }

    ...

}

The only issue with that is that wp_count_posts() caches its results and since your filter bypasses the cache you might have to devalidate the cache, first.

Or (better), copy the wp_count_posts() function and modify it to your needs, so you don’t have to use the filter, don’t have to sum up the results and avoid having the rest done that it does.