Accessing PHP Objects from WordPress Functions

Solution:

for firstclass.php

<?php

    class Firstclass{
        function __construct(){

        }
        function init(){

        }
        function temp1(){

        }

    }

    if(class_exists('Firstclass'))
        $firstclass_object = new Firstclass();
?>

In secondclass.php, you can access functions of firstclass.php as

<?php
    class Firstclass{
        function __construct(){

        }
        function temp2(){
            global $firstclass_object;
            $firstclass_object-> temp1;       
        }    
    }
?>

Here for your answer, you can do that as below

//for accessing form id declare it as a global variable
global $email;    
echo $email->formid;